package com.cinema;

import java.io.IOException;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import query.DataQuery;

import com.cinema.data.Adminusr;

public class RemoveFilm extends HttpServlet{

	/**
	 * 
	 */
	public RemoveFilm(){
		super();
	}
	private static final long serialVersionUID = 4010782057746594985L;
	public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
		doPost(req, resp);
	}
	
	public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
		HttpSession s = request.getSession();
		Adminusr user = (Adminusr)s.getAttribute("adminuser");
		long filmid = Long.parseLong(request.getParameter("fid"));
		
		if(user == null)
			response.sendRedirect("admincp.html");
		else{
			DataQuery query = new DataQuery();
			query.removeFilm(filmid);
			response.sendRedirect("ticket?pageid=2");
		}
	}
}